package demo4;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 何华树
 * Date: 2024-09-02
 * Time: 12:40
 */
public class Test {
    public static void func(Animal animal) {
        animal.eat();
    }
    public static void func_fly(Ifly ifly) {
       ifly.fly();
    }
    public static void func_swim(ISwimming iSwimming) {
        iSwimming.swim();
    }
    public static void func_run(IRunning iRunning) {
        iRunning.run();
    }

    public static void main(String[] args) {
        Duck duck = new Duck("唐老鸭",10);
        func(duck);
        func_fly(duck);
        func_run(duck);
        func_swim(duck);
        System.out.println("============");
        Dog dog = new Dog("旺财",10);
        func(dog);
        func_run(dog);
        func_swim(dog);
        System.out.println("===============");
        Fish fish = new Fish("小彩",10);
        func(fish);
        func_swim(fish);

    }
    public static void main1(String[] args) {
//        func(new Dog());
//        func(new Fish());
//        func(new Duck());
    }
}
